<form (ngSubmit)="onRegister()" #form="ngForm" class="form-box">
  <div class="form-group">
      <label>手机号码</label>
      <input
          type="text"
          name="phone"
          #phone="ngModel"
          class="form-control"
          placeholder="请输入手机号码"
          [(ngModel)]="formInfo.phone"
          required
          pattern="1[3,4,5,6,7,8]\d{9}"
          appPhoneValidate
      />

      <div class="errors" [hidden]="phone.valid || phone.untouched">
          <p *ngIf="phone?.errors?.required">请输入手机号码</p>
          <p *ngIf="phone?.errors?.pattern">手机号码不合法</p>
          <p *ngIf="phone?.errors?.validatePhone">手机号码已被注册</p>
      </div>
  </div>
  <div class="form-group">
      <label>密码</label>
      <input
          type="password"
          name="password"
          #password="ngModel"
          class="form-control"
          placeholder="请输入密码"
          [(ngModel)]="formInfo.password"
          required
      />
      <div class="errors" [hidden]="password.valid || password.untouched">
          <p *ngIf="password?.errors?.required">请输入密码</p>
      </div>
  </div>
  <button class="btn btn-primary" [disabled]="phone.invalid || isDisabled" (click)="sendCode()">{{btnText}}</button>
  <button type="submit" class="btn btn-default" [disabled]="form.invalid">注册</button>
</form>
